package red.don.learn.mapper;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Select;

import red.don.learn.entity.CustomerEntity;

public interface CustomerMapper {

  /**
   * Insert one customer.
   *
   * @param customer {Customer} Customer information.
   * @return {void} Nothing.
   */
  @Insert("INSERT INTO `database`.`customer`(`name`, `gender`, `telephone`) VALUES (#{name}, #{gender}, #{telephone})")
  public void insertOne(CustomerEntity customer);

  /**
   * Delete all customers.
   *
   * @return {void} Nothing.
   */
  @Delete("TRUNCATE `customer`")
  public void deleteAll();

  /**
   * Select all customers.
   *
   * @return {List<CustomerEntity>} All customers.
   */
  @Select("SELECT * FROM `customer`")
  public List<CustomerEntity> selectAll();

  /**
   * Count the number of customers.
   *
   * @return {int} Total.
   */
  @Select("SELECT COUNT(1) FROM `customer`")
  public int count();

}
